package com.hlkj.baojin.dao;

import com.hlkj.baojin.entity.Company;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

/**
 * @author HULIN
 * @created with: baojin
 * @package com.hlkj.baojin.dao
 * @description:
 * @date 2018/12/17 12:39
 * @modified By:
 * @Copyright © 2018 HAILIANG Info. Tech Ltd. All rights reserved.
 */
public interface ICompanyDao  extends MongoRepository<Company, String> {
    Company findByIdAndDelete(String companyId, Integer delete);

    Company findByIndexNumAndDelete(String indexNum, Integer delete);

    Company findByIdAndDeleteIn(String companyId, Integer ... delete);

    @Query(value = "{'name':{$regex:'.*?0.*'}}", fields = "{'_id':1}")
    List<Company> getIdsByNameLike(String name);

    Company findByCompanyPrincipalPhoneAndDelete(String companyPrincipalPhone, Integer delete);

    List<Company> findByDeleteNot(Integer delete);

    List<Company> findByDelete(Integer delete);

    Company findByNameAndDelete(String name, Integer delete);

    Company findByIndexNum(String companyId);
}
